import { _decorator, Component, Node } from 'cc';
import { GameApp } from './game/GameApp';
import { TimerManager } from './frameworks/base/TimerManager';
const { ccclass, property } = _decorator;

@ccclass('Main')
export class Main extends Component {
    private app!: GameApp;
    // public delta: number = 0;
    // public deltatime: number = 0;
    start() {
        console.log("game start");
        this.init();
    }

    async init() {
        this.app = new GameApp();
        await this.app.start();
    }

    update(deltaTime: number) {
        // ++this.delta;
        // this.deltatime += deltaTime;
        // if (this.delta > 100) {
        //     console.log("game update, delta:", this.deltatime);
        //     this.delta = 0;
        //     this.deltatime = 0;
        // }
        TimerManager.inst.update(deltaTime);
    }

    lateUpdate(deltaTime: number) {
        TimerManager.inst.lateUpdate(deltaTime);
    }

    onDestroy() {
        //SoundManager.instance.destroy();
    }
}

